<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">计算外部用户</ui:define>
    <ui:define name="content">
        <script type="text/javascript">
            $(function () {





            });
        </script>
        <h:form>
            <p:dialog header="预估用户数量中,请稍候" widgetVar="loadingDialog" modal="true" closable="false" resizable="false"
                      draggable="false"/>
                      
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar id="buttonToolBar">

                    <f:facet name="right">
                        <p:commandButton
                                actionListener="#{calculateExternalSmsBean.onReset}"
                                icon="fa fa-refresh"
                                value="重置查询条件"
                                process="@this"
                                update="@form"/>
                        <p:commandButton
								actionListener="#{calculateExternalSmsBean.onCalculateCount}"
                                icon="fa fa-calculator"
                                value="计算用户数量"
                                update="@form"/>
                                
                        <p:commandButton
                                actionListener="#{calculateExternalSmsBean.onEstimate}"
                                icon="fa fa-gavel"
                                value="预估"
                                update="@form"
                                onstart="PF('loadingDialog').show();"
                                oncomplete="PF('loadingDialog').hide();"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <h:panelGroup rendered="#{calculateExternalSmsBean.estimatedSmsCount != null}">
                        <div class="ui-g-12">
                            <div class="card ui-g-12">
                                <div class="ui-g-12">
                                    短信预估人数 : <h:outputText style="color: red;"
                                                           value="#{calculateExternalSmsBean.estimatedSmsCount}"/>
                                </div>
                            </div>
                        </div>
                    </h:panelGroup>
                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <div class="ui-g-1">
                            <p:outputLabel value="任务名称"/>
                                <strong style="color: red">*</strong>
                        </div>
                            <div class="ui-g-11">
                                <p:inputText value="#{calculateExternalSmsBean.$.name}"/>
                            </div>
                        </div>
                    </div>

                    <div class="ui-g-12">
                        <div class="card ui-g-12">

                            <div class="ui-g-1">
                                <p:outputLabel value="选择通道"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectOneMenu
                                        value="#{calculateExternalSmsBean.$.externalChannel}" filter="true"
                                        filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{calculateExternalSmsBean.dictionaries[DictionaryCode.SMS_EXTERNAL_CHANNEL]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>

                        </div>
                    </div>


                    <div class="ui-g-12">

                        <div class="card ui-g-12">

                            <div class="ui-g-1">
                                <p:outputLabel value="获取同盾分时间"/>
                            </div>
                            <div class="ui-g-5">
                                <p:calendar value="#{calculateExternalSmsBean.$.tongDunStartTime}"
                                            styleClass="autoWidthCalendar"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"
                                            navigator="true"
                                            converterMessage="日期格式输入错误! 例子: 2018-04-23"/>
                                <span>—</span>
                                <p:calendar value="#{calculateExternalSmsBean.$.tongDunEndTime}"
                                            styleClass="autoWidthCalendar"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"
                                            navigator="true"
                                            converterMessage="日期格式输入错误! 例子: 2018-04-23"/>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="同盾分"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-2">
                                <p:inputNumber id="tongDunMinScore" minValue="0" value="#{calculateExternalSmsBean.$.tongDunMinScore}"/>
                            </div>
                            <div class="ui-g-2">
                                <p:inputNumber id="tongDunMaxScore" maxValue="100" value="#{calculateExternalSmsBean.$.tongDunMaxScore}"/>
                            </div>

                        </div>
                    </div>

                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                        
                            <div class="ui-g-1">
                                <p:outputLabel value="运营商"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectCheckboxMenu label="运营商" id="telecomOperators" value="#{calculateExternalSmsBean.$.telecomOperators}"
                                                      updateLabel="true" multiple="true" filter="true">
                                    <f:selectItem itemLabel="移动" itemValue="移动"/>
                                    <f:selectItem itemLabel="联通" itemValue="联通"/>
                                    <f:selectItem itemLabel="电信" itemValue="电信"/>
                                </p:selectCheckboxMenu>
                            </div>


                            <div class="ui-g-1">
                                <p:outputLabel value="用户类型"/>
                            </div>
                            <div class="ui-g-5">
                                <p:selectCheckboxMenu label="用户类型" id="userTypes" value="#{calculateExternalSmsBean.$.userTypes}"
                                                      updateLabel="true" multiple="true" filter="true">
                                    <f:selectItem itemLabel="注册用户" itemValue="0"/>
                                    <f:selectItem itemLabel="登记未注册用户" itemValue="1"/>
                                </p:selectCheckboxMenu>
                            </div>
                            

                            <div class="ui-g-1">
                                <p:outputLabel value="地区"/>
                                <strong style="color: red">*</strong>
                            </div>
                            <div class="ui-g-5">
                                <p:selectCheckboxMenu label="地区" id="province" value="#{calculateExternalSmsBean.$.provinces}"
                                                      updateLabel="true" multiple="true" filter="true">
                                    <f:selectItems value="#{calculateExternalSmsBean.provinces}" />
                           		</p:selectCheckboxMenu>
                            </div>
                            
                        </div>
                        
                    </div>
                </div>
             </div>
        </h:form>
    </ui:define>
</ui:composition>